package xyz.zyt123.hikvideo;

import jakarta.annotation.PreDestroy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import xyz.zyt123.hikvideo.config.HikSdkConfig;
import xyz.zyt123.hikvideo.util.CameraThread;
import xyz.zyt123.hikvideo.util.TimerUtil;

@SpringBootApplication
public class HikVideoApplication {

  @Autowired
  private HikSdkConfig hikSdkConfig;

  public static void main(String[] args) {
    SpringApplication.run(HikVideoApplication.class, args);
  }

  @PreDestroy
  public void destroy() {
    System.err.println("释放空间...");
    // 关闭线程池
    CameraThread.MyRunnable.es.shutdownNow();
    // 销毁定时器
    TimerUtil.timer.cancel();
  }
}
